-
Notifications
You must be signed in to change notification settings - Fork 4
Feat: Role Based Capabilities #174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
chrisgitiota
merged 16 commits into
feat/audit-trails-dev
from
feat/audit-trails-dev-caps-extended
Jan 16, 2026
Merged
Feat: Role Based Capabilities #174
chrisgitiota
merged 16 commits into
feat/audit-trails-dev
from
feat/audit-trails-dev-caps-extended
Jan 16, 2026
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Also split of the role and capability management from the AT main module to allow reuse with other products.
…extended # Conflicts: # audit-trail-move/sources/audit_trail.move # audit-trail-move/sources/capability.move # audit-trail-move/tests/capability_tests.move # audit-trail-move/tests/create_audit_trail_tests.move # audit-trail-move/tests/role_tests.move # audit-trail-move/tests/test_utils.move
itsyaasir
reviewed
Jan 8, 2026
Contributor
itsyaasir
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nothing stands out at the moment and looks good to me, as we discussed, we will be moving this to the product repo right ?
feat(docs): Example to estimate gas cost
…extended # Conflicts: # audit-trail-move/sources/audit_trail.move # audit-trail-move/tests/capability_tests.move
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of change
This PR introduces a new module
audit_trail::role_mapproviding theRoleMap<P>struct and associated functions:A very simple example-integration of the
RoleMapcan be found below in the most bottom section.RoleMapintegration into AuditTrails:RoleMapis integrated in theaudit_trail::mainmodule to manage access to the audit trail records andtheir operations. See here for an example.
RoleMapis created by theAuditTrailin it's create function.The
RoleMapdirectly depends on theaudit_trail::capability::Capabilitymodule. Both modules are tight strongly together but can be used generically by all of our TF products and by community developer projects as dependencies.As the
RoleMapand theaudit_trail::capability::Capabilitymodules can be used with any TF product or community developer smart contract, it shall be moved to theproduct-corerepository. Theaudit_trail::mainmodule will use these modules as dependencies then. The current plan is to introduce a new package inproduct-coreto collect modules, dedicated to be used by community developers. The packageproduct_commonis dedicated to be used internally by the PA team and the new package would contain modules (Move, Rust, TS) officially provided for community devs.All names are not set in stone and there might be better names, especially for the
RoleMapwhich might better be calledRoleBasedCapabilities(RBC) or ..... ???This PR also extends the
audit_trail::capability::Capabilitys with additional optional restrictions:issued_to,valid_untilandvalid_from.How the change has been tested
In the
audit-trail-movefolder:Remaining TODOs / Known Issues
RoleMapfieldissued_capabilitiesuses aVecSet<ID>ATM causing size limitation. Will probably replaced by aiota::table<ID>.Example for integrating the
RoleMapinto 3rd party shared objects (or TF products)To use the
RoleMapfor a custom project (i.e. a shared Counter like this) one would just need to define a Permission enum similar to the enum we are using for Audit Trails.For example the Permission enum for a shared
Countercould look like this:In the file
counter/permission.move:The
Counterobject then would need to instantiate therole_map::RoleMap<CounterPermission>in its create function like this:In the file
counter/counter.move:Later on the
Countercan use theRoleMap.is_capability_valid()function like the Audit Trail does:In the file
counter/counter.move:Using the shared Counter object would look like this:
In the file
tests/counter_tests.move: